<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>A2A Inspector</title>
    <link rel="stylesheet" href="/static/styles.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
    <link rel="icon" href="https://a2aproject.github.io/A2A/latest/assets/a2a-logo-black.svg">
</head>

<body>
    <div class="container">
        <h1>A2A Inspector</h1>
        <div class="url-input-container">
            <input type="text" id="agent-card-url" placeholder="Enter Agent Card URL">
        </div>
        <div class="http-headers-container">
            <div class="http-headers-header" id="http-headers-toggle">
                <span class="toggle-icon">▼</span> HTTP Headers
            </div>
            <div class="http-headers-content" id="http-headers-content">
                <div id="headers-list">
                    <!-- Headers will be added here dynamically -->
                </div>
                <button id="add-header-btn">+ Add Header</button>
            </div>
        </div>
        <div class="connect-btn-container">
            <button id="connect-btn">Connect</button>
        </div>
        <div id="agent-card-section">
            <h2 class="collapsible-header">
                <span class="toggle-icon">▼</span> Agent Card
            </h2>
            <div class="collapsible-content">
                <div id="validation-errors">
                    <p class="placeholder-text">Connect to an agent to see its card.</p>
                </div>
                <div class="agent-card-display">
                    <pre><code id="agent-card-content" class="language-json"></code></pre>
                </div>
            </div>
        </div>
        <div id="chat-container">
            <h2 class="chat-header">Chat</h2>
            <p class="chat-info">
                Messages from the agent are marked with ✅ (compliant) or ⚠️ (non-compliant). Click any message to view the raw JSON.
            </p>
            <div id="chat-messages">
                <p class="placeholder-text">Messages will appear here.</p>
            </div>
            <div class="chat-input-container">
                <input type="text" id="chat-input" placeholder="Type a message..." disabled>
                <button id="send-btn" disabled>Send</button>
            </div>
        </div>
    </div>

    <div id="debug-console" class="hidden">
        <div id="debug-handle">
            <span>Debug Console</span>
            <div class="debug-controls">
                <button id="clear-console-btn">Clear</button>
                <button id="toggle-console-btn">Show</button>
            </div>
        </div>
        <div id="debug-content"></div>
    </div>

    <div id="json-modal" class="modal-overlay hidden">
        <div class="modal-content">
            <span class="modal-close-btn">&times;</span>
            <h3>Raw JSON</h3>
            <pre id="modal-json-content"></pre>
        </div>
    </div>

    <script src="/static/script.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
</body>

</html>
